
import scala.math._

object ScalaMagic {

    def main(args: Array[String]): Unit = {
        // 下划线_
        val list: List[Int] = List(1, 2, 3)

        // 匿名函数
        // list.map(x => x * 10)
        list.map(_ * 10)
        // list.sortWith((x, y) => x < y)
        list.sortWith(_ < _)

        // 模式匹配
        list match {
            case List(1, _, _) => ""
            case List(_*) => ""
            case _ => ""
        }



        // 通配符
        println(Pi)


        var map: Map[_, _] = Map("key" -> "value")
        println(map)


        method(1 to 5: _*)

        var function = method _

        // partial function application
        // method(_)

        for (_ <- 1 to 5) {

        }


    }


    def method(args: Int*): Unit = {
        // Range
        println(args)
    }


}


class IntClass() {
    // 默认值
    private var _int: Int = _

    // getter
    def int: Int = _int

    // setter
    def int_(int: Int): Unit = {
        _int = int
    }
}